import requests
import json
from collections import Counter


session = requests.session()

headers = {
    'Host': 'match.yuanrenxue.com',
    'Connection': 'keep-alive',
    'Content-Length': '0',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache',
    'sec-ch-ua': '"Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"',
    'sec-ch-ua-mobile': '?0',
    'User-Agent': 'yuanrenxue.project',
    'Accept': '*/*',
    'Origin': 'https://match.yuanrenxue.com',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Dest': 'empty',
    'Referer': 'https://match.yuanrenxue.com/match/3',
    'Accept-Encoding': 'gzip, deflate, br',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Cookie': 'm=e947cc82ae3f01bb8c2f2558a6f44021|1628649493000; qpfccr=true; no-alert3=true; Hm_lvt_c99546cf032aaa5a679230de9a95c7db=1626513681,1627891147,1628591690,1628650415; Hm_lvt_9bcbda9cbf86757998a2339a0437208e=1626511674,1627891150,1628591693,1628650417; sessionid=9ycxkyqmfgdwd6erkwxci4qnfw1zf0cu; tk=-1441797013665424220; Hm_lpvt_9bcbda9cbf86757998a2339a0437208e=1628650497; Hm_lpvt_c99546cf032aaa5a679230de9a95c7db=1628652423',
}


session.headers = headers
url1 = 'https://match.yuanrenxue.com/jssm'
url2 = 'https://match.yuanrenxue.com/api/match/3?page={}'

item = {}
list_ = list()
res = session.post(url=url1,headers=headers)
for i in range(1,6):
    res = session.post(url=url1)
    res = json.loads(session.get(url=url2.format(i)).text)

    for i in res['data']:
        list_.append(i['value'])

print(Counter(list_))



